package com.itheima.config;

import com.itheima.pojo.Apple;
import com.itheima.pojo.User;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class UserConfig {
	@Bean
	public Apple apple(){
		return new Apple();
	}

	@Bean
	//@Conditional(ClassCondition.class)
	//@ConditionalOnBean(Apple.class)
	//
	// @ConditionalOnMissingBean(Apple.class)
	@ConditionalOnProperty(name = "itcast",havingValue = "363")
	public User user() {

		return new User(22,"zhangsn");
	}



}
